##配置
import os
from qwen_agent.agents import Assistant
llm_cfg = {
    "model": "qwen-plus",
    "model_server": "dashscope",
    "api_key": os.getenv("DASHSCOPE_API_KEY"),
    "generta_cfg": {
        "top_p": 0.7
    }
}
files = ['./浦发上海浦东发展银行西安分行个金客户经理考核办法.pdf']
## 构建智能体
bot = Assistant(
    llm=llm_cfg,
    system_message="你是一个浦发上海浦东发展银行智能助手,只能回答银行相关的问题, 其余问题不用回答",
    function_list=[],
    files=files
)
messages = []
query = "客户经理未建立信贷台帐资料及档案的每笔扣多少分?"
messages.append({"role": "user", "content": query})
res_chunk_list = list(bot.run(messages=messages))
# print("res_chunk_list:", len(res_chunk_list))
# print("res_chunk_list:", res_chunk_list)
print("最终回答:", res_chunk_list[-1][0].get("content"))
# for res in res_chunk_list:
#     content = res[0].get("content")
#     print(content)
